function f_print_progress_info()
{
    declare progress_info progress_tool progress_table fun_name
    fun_name="f_print_progress_info"
    progress_tool="${1}"
    progress_table="${2}"
    #_send_progress_info_1   控制每分钟执行一次, ${t_state_task}
    #_send_progress_info_10  控制每十分钟入库一次, ${t_prog_task}
    [ -z "${_send_progress_info_10}" ] && _send_progress_info_10="${script_start_time}" && _send_progress_info_1="${script_start_time}"
    send_progress_info="$(date +%s)" #记录当前时间, 判断当前时间和_send_progress_info_的差值是否是大于10min

    if [ $((${send_progress_info}-${_send_progress_info_1})) -lt 60 ]
    then #每分钟采集一次状态并入库${t_state_task}
        return 0
    fi

    _send_progress_info_1="$(date +%s)"
    if [ "${progress_tool}x" == "gh-ostx" ]
    then #解析ghost的日志, 格式化以后好入库
        progress_info="$(grep "^Copy" ${res_log}|sed 's/1[0-9][0-9]\.[0-9]%/100\.0%/g'|awk '{print $3,$NF}'|sed 's/;//g'|uniq|sed 's/$/;/g'|tail|tr -d "\n")" || true
    elif [ "${progress_tool}x" == "pt-online-schema-changex" ]
    then #解析pt-osc的日志, 格式化以后好入库
        progress_info="$(grep "^Copy" ${res_log}|awk '{print $3,$4}'|awk -F: '{if ($3==""){print $1"m"$2"s"}
            else if($4==""){print $1"h"$2"m"$3"s"}else{print $1"d"$2"h"$3"m"$4"s"}}'|sed 's/;//g'|uniq|sed 's/$/;/g'|tail|tr -d "\n")" || true
    else #不是ghost pt-osc就不做后面操作
        return 0
    fi

    [ -z "${progress_info}" ] && return 0
    progress_info="$(sed 's#N/A#计算中#g;s#due#即将完成, 请耐心等待#g' <<< "${progress_info}")" || true
    __="update ${t_state_task} set progress = '$(tr ";" "\n" <<< "${progress_info}"|awk '/%/{print $0}'|tail -1|sed 's/^/ongoing:/g;s/% /%, remaining:/g')' 
        where order_id = ${user_order_id};" || true
    f_exe_sql_to_dbadb "${__}" "f_print_progress_info" || true

    if [ "${_send_progress_info_10}x" == "${script_start_time}x" ]
    then #表示是第一次记录改表进度状态, 要求第一次是十分钟发一次邮件
        if [ $((${send_progress_info}-${_send_progress_info_10})) -lt 600 ]
        then
            return 0
        fi
    elif [ "$(tr ";" "\n" <<< "${progress_info}"|sed '/^$/d'|tail -1|grep -c "[1-9]h")x" != "0x" ]
    then #表示不是第一次记录了, 这时候判断最后一次进度是否大于1小时, 如果大于1h就隔30min再发邮件
        if [ $((${send_progress_info}-${_send_progress_info_10})) -lt 1800 ]
        then
            return 0
        fi
    elif [ "$(grep -c "[1-9]h" <<< "${progress_info}")x" == "0x" ]
    then #表示不是第一次记录了, 这时候判断进度是否大于1小时, 如果不大于1h还是隔10min再发邮件
        if [ $((${send_progress_info}-${_send_progress_info_10})) -lt 600 ]
        then
            return 0
        fi
    fi

    if [ "${global_osc_run_state}x" != "0x" ] 
    then #改表进程正常工作才发邮件, 比如人为暂停了就不发了
        return 0
    fi

    #将进度入库, 给监控脚本发邮件monitor_for_alter_table_schedule.sh
    __="insert into ${t_prog_task}(order_id,user_mail,port,table_name,send_state,start_time,remarks) select ${user_order_id},
        '${g_user_mail_addr}',${mysql_port},'${mysql_db}.${progress_table}',0,'$(date -d @${script_start_time} "+%F %H:%M:%S")','${progress_info}';"
    f_exe_sql_to_dbadb "${__}" "f_print_progress_info" || true
    _send_progress_info_10="${send_progress_info}" #更新判断时间, 好判断下一次十分钟
    f_get_html_info_prepare_for_pro "${mysql_port}" "${user_order_id}" || true   #将进度打印出来, 发送邮件
    return 0
}

